{% extends "base.html" %}
{% load i18n %}
{% block menu %}
    <strong>{{ user|capfirst }}</strong>
    {% block menu_entries %}
    {% if user.is_superuser %}
        <a href="{% url fileshare.views.allfiles %}">{% trans "all files"|capfirst %}</a>
    {% endif %}
    {% endblock %}

    <a href="{% url django.contrib.auth.views.logout %}">{% trans "logout"|capfirst %}</a>
{% endblock %}
{% block content %}
{% if form %}
    <form enctype="multipart/form-data" action="{% url fileshare.views.upload %}" method="post">
        <fieldset>
            <legend>{% trans "upload file"|capfirst %}</legend>
            {% trans "max file size"|capfirst %} - {{ MAX_UPLOAD_SIZE|filesizeformat }}<br />
            {{ form }}
            <input type="submit" class="button positive" value="{% trans "submit"|capfirst %}" />
        </fieldset>
    </form>
{% endif %}

<fieldset>
<legend>{% trans "files list"|capfirst %}</legend>
{% block file_list %}
<table>
    <tr class="top" >
        <td>{% trans "link" %}</td>
        <td>{% trans "download count" %}</td>
        <td>{% trans "size" %}</td>
        <td>{% trans "avalible" %}</td>
        <td></td>
    </tr>
    {% load mimetype %}
    {% for item in files %}
    <tr>
        <td><a {% if 'image/' in item.name|mimetype %}class="showinbox"{% endif %} href="{% url fileshare.views.download item.uuid item.name %}">{{ item.name }}</a></td>
        <td>{{ item.downloads }}</td>
        <td>{{item.file.size|filesizeformat}}</td>
        <td><a class="button" href="{% url fileshare.views.change_file_state item.pk %}">{% if item.avalible %} <img src="{{ tick_button }}" alt="{% trans "avalible" %}" /> {% else %} <img src="{{ cross_button }}" alt="{% trans "not avalible" %}" /> {% endif %}</a></td>
        <td><a class="button" href="{% url fileshare.views.delete_file item.pk %}"><img src="{{ delete_button }}" alt="{% trans "delete" %}" /></a></td>


    </tr>
    {% endfor %}
</table>
{% endblock %}
</fieldset>
{% endblock %}
